from common.connect_db import MyDB

my_db = MyDB()


class DataBaseOffShop:

    @staticmethod
    def filter_life_offline_shop_shops_by_shop_name(shop_name):
        """
        通过店铺名称获得详细信息
        :param shop_name:
        :return:
        """
        sql = "select * from life_offline_shop_shops where shop_name= '%s'" % shop_name
        result = my_db.execute_select('offshop', sql)
        if len(result) == 1:
            return result[0]
        else:
            raise ValueError('查询不到商家信息！')


if __name__ == '__main__':
    store_info = DataBaseOffShop.filter_life_offline_shop_shops_by_shop_name('自动化测试商家（勿拍）')
    print(store_info.id)
    print(store_info.member_rebate_rate)
